package com.acme.bankapp.domain.bank;

import java.util.ArrayList;

/**
 * Class which represents typical Bank Client
 * 
 * @author render1980
 *
 */
public class Client {
	/**
	 * List which contains all client accounts
	 */
	private ArrayList<Account> accounts = new ArrayList<Account>(); 
	private String name = null;
	private Gender gender = null;
	
	public Client() { }
	
	public Client(String name, Gender gender) {
		this.name = name;
		this.gender = gender;
	}
	
	/**
	 * Method to get Client name
	 * 
	 * @return	name of the client
	 */
	public String getName() {
		return this.name;
	}
	
	/**
	 * Method to get Client gender
	 * 
	 * @return	gender of the client
	 */
	public Gender getGender() {
		return this.gender;
	}
	
	/**
	 * Method to print salutation to current Client
	 */
	public void getClientSalutation() {
		if(this.gender != null) {
			System.out.println("Hi, " + this.gender.getPrefix() + " " + this.name);
		}
	}
	
	/**
	 * Method to get all Client accounts
	 * 
	 * @return	Array of client accounts
	 */
	public Account[] getAccounts() {
		return this.accounts.toArray(new Account[accounts.size()]);
	}
	
	/**
	 * Method which set desired account to Client
	 * 
	 * @param account	Account which must be added to client accounts collection
	 */
	public void setAccount(Account account) {
		this.accounts.add(account);
	}
}